image_name       := my-samba
container_name   := my-samba
host_username    := $(shell whoami)
samba_userid     := $(shell id -u)
samba_username   := $(host_username)
samba_passwd     := abcd12345


all:
	@echo "nothing to do"


build: rm-image
	docker build . -t $(image_name):latest


start:
	docker run -it --rm \
	--name $(container_name) \
	-e UID=$(samba_userid) \
	-e NAME=$(samba_username) \
	-e PASSWD=$(samba_passwd) \
	-p 445:445 \
	-p 139:139 \
	-v /home/$(host_username)/Docker/samba/:/etc/samba:ro \
	-v /home/$(host_username):/home/$(samba_username):rw \
	-v /home/$(host_username)/Shared:/home/$(samba_username)/Shared:rw \
	$(image_name)


rm-image:
	-@docker rmi -f $(image_name) 2> /dev/null
